{template 'common/header'}
<ul class="nav nav-tabs" id="myTab">
    <li>
		<a href="?c=home&a=welcome&do=ext&m={php echo $_GPC['m']}">返回</a>
	</li>
	<li class="active"><a href="{php echo $this->createWebUrl('credit',array('op'=>'goods'));}">礼品管理</a></li>
    <li><a href="{php echo $this->createWebUrl('credit_request')}">兑换请求管理</a></li>
</ul>

<div class="main">

<form action="" method="post" class="form-horizontal" role="form" ng-controller="formCtrl" id="form2">
	<div class="panel panel-default">
		<div class="panel-body table-responsive">
			<table class="table table-hover" style="display:auto;">
				<thead class="navbar-inner">
					<tr>
					   <th style="width:25px;">选？</th>
						<th style="width:160px;">奖品名称</th>
						<th style="width:80px;">剩余数量</th>
						<th style="width:120px;">价格</th>
						<th style="width:100px;">消耗积分</th>
						<th style="width:480px;">操作</th>
					</tr>
				</thead>
				<tbody>
					<tr ng-repeat="item in list">
					   <td><input type="checkbox" name="select[]" value="{{item.id}}"></td>
						<td>{{item.title}}</td>
						<td>{{item.amount}}</td>
						<td>{{item.price}}</td>
						<td>{{item.cost}}</td>
						<td >
							<a class="btn btn-default" href="{{item.edit}}">编辑</a>
							<a class="btn btn-default" href="{{item.delete}}">删除</a>
							<a class="btn btn-default" href="{{item.yu}}">预览</a>
						</td>
					</tr>
				</tbody>
				<tr>
					<td><input type="checkbox" onclick="var ck = this.checked;$(':checkbox').each(function(){this.checked = ck});"></td>
                    <td colspan="12">
                        <input type="submit" class="btn btn-danger" name="delete" value="删除" />
                        <a class="btn btn-default" href="{php echo $this->createWebUrl('credit_goods',array('op'=>'post'))}" >添加</a>
                    </td>
				</tr>
			</table>
			
		</div>
	</div>
</form>
</div>
{$pager}

<script>
	require(['angular', 'jquery', 'util'], function(angular, $, util){

		var app = angular.module('app', []);
		app.controller('formCtrl', function($scope,$http){
			$scope.list = {php echo json_encode($list)};
			$scope.delete = function (){
				var select = $scope.select;
				alert(select);
			}
			$scope.submit = function() {
	            $('#form2')[0].submit();
	        };
		});

		
		angular.bootstrap(document, ['app']);
	});
</script>

{template 'common/footer'}